export default class EarnCoinData {
  public sign = 0;
  public freeTime = 0;
  public shareGroup = 0;
  public date = '';
  constructor() {
    this.sign = 0; // 签到标志
    this.freeTime = 0; // 免费领取次数
    this.shareGroup = 0; // 分享到群次数
    this.date = new Date().toDateString();
  }
  public parseValue(cvalue: any) {
    if (cvalue.hasOwnProperty('sign')) {
      this.sign = cvalue.sign;
    }
    if (cvalue.hasOwnProperty('freeTime')) {
      this.freeTime = cvalue.freeTime;
    }
    if (cvalue.hasOwnProperty('shareGroup')) {
      this.shareGroup = cvalue.shareGroup;
    }
    if (cvalue.hasOwnProperty('date')) {
      this.date = cvalue.date;
    }
    const today = new Date().toDateString();
    if (this.date !== today) {
      this.date = today;
      this.sign = 0;
      this.freeTime = 0;
      this.shareGroup = 0;
    }
  }
}